using System;
using System.Data;
using System.Runtime.Serialization;
namespace Common
{
    /// <summary>
    /// Summary description for AuditoriaBDData.
    /// </summary>

    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public class AuditoriaBDData : DataTable
    {
        #region Constructor
        protected AuditoriaBDData(SerializationInfo info, StreamingContext context)
        {
        }

        public AuditoriaBDData()
        {
            BuildDataTables();
        }
        #endregion

        #region  Constants for table and fields mapping

        public const String ADM_REGISTRO_AUDITORIA_BD_TABLE = "ADM_REGISTRO_AUDITORIA_BD";

        public const String ROW_NUMBER_FIELD = "RowNumber";
        public const String TEXT_DATA_FIELD = "TextData";
        public const String DATA_BASE_ID_FIELD = "DatabaseID";
        public const String HOST_NAME_FIELD = "HostName";
        public const String APPLICATION_NAME_FIELD = "ApplicationName";
        public const String LOGIN_NAME_FIELD = "LoginName";
        public const String START_TIME_FIELD = "StartTime";

        #endregion

        /// <summary>
        /// Creates the following datatables: ADM_REGISTRO_AUDITORIA_BD 
        /// </summary>
        private void BuildDataTables()
        {
            this.Columns.Add(ROW_NUMBER_FIELD, typeof(System.Decimal));
            this.Columns.Add(TEXT_DATA_FIELD, typeof(System.String));
            this.Columns.Add(DATA_BASE_ID_FIELD, typeof(System.Decimal));
            this.Columns.Add(HOST_NAME_FIELD, typeof(System.String));
            this.Columns.Add(APPLICATION_NAME_FIELD, typeof(System.String));
            this.Columns.Add(LOGIN_NAME_FIELD, typeof(System.String));
            this.Columns.Add(START_TIME_FIELD, typeof(System.DateTime));

            this.PrimaryKey = new DataColumn[] { this.Columns[AuditoriaBDData.ROW_NUMBER_FIELD] };
        }

        /// <summary>
        /// Add a new row to the table
        /// </summary>
        /// <param name="fila"></param>
        public void addRow(DataRow fila)
        {
            this.Rows.Add(fila);
        }
    }
}
